<script type="text/javascript">
$(function(){
	loadComment();
});

function loadComment(){
	$("#comment_list").load('/comment.do?parameter=page&page=1&nid=$!thisNews.id');
}
						
						function _getIco(t){
							var o = $(t).offset();
							if($("#EmoList").is(":hidden")){
								$("#EmoList").css({
									top:o.top+32,
									left:o.left
								}).show();
							}else{
								$("#EmoList").hide();
							}
							
							$(t).blur();
						}
						
						function doComment(){
							var isLogin = false;
							/*
							#if($user)
							*/
								isLogin=true;
							/*
							#end
							*/
							if(!isLogin){
								logTip();
							}else{
								$.ajax({
									type: "POST",
									url:'/user.do?parameter=comment',
									data:{"comment":$('#comment').val(),"newsid":'$!thisNews.id',"id":'$!thisType.id'},
									cache: false,
									success: function(msg){
										alert(msg);
										loadComment();
									}
								});	
							}
						}
						
						function doDeleteComment(cid){
							var isLogin = false;
							/*
							#if($user)
							*/
								isLogin=true;
							/*
							#end
							*/
							if(!isLogin){
								logTip();
							}else{
								$.ajax({
									type: "POST",
									url:'/user.do?parameter=deleteComment',
									data:{"id":cid},
									cache: false,
									success: function(msg){
										alert(msg);
										loadComment();
									}
								});	
							}
						}
						
						function logTip(){
							if($("#bgDiv").length == 0){
								$("body").append("<div id='bgDiv' />");
								$("#bgDiv").css("opacity",0.9);
							}
							
							var __t = $("#logTip");
							
							var w = document.documentElement.clientWidth || document.body.clientWidth,
								h = document.documentElement.clientHeight || document.body.clientHeight,
								st = document.documentElement.scrollTop || document.body.scrollTop;
							
							var dw = __t.outerWidth(), dh = __t.outerHeight();
							__t.css({
								top: (h - dh) / 2 + st,
								left: (w - dw)  /2
							}).fadeIn();
							
							$("#bgDiv").css({
								height:(h > $("body").height()) ? h : $("body").height(),
								"opacity":0.5
							}).show().click(function(){
								__t.hide();
								$("#bgDiv").hide();
							});
							
						}
						
						function addEm(num){
							$("#comment").val($("#comment").val()+"[emo"+num+"]");
							$("#EmoList").hide();
						}
						
						/*
						$(function(){
							$("#EmoList a").click(function(){
								$(this).addClass("active").parent().siblings().children().removeClass("active");
								$(this).blur();
							});
						})
						*/
						</script>
					<!--Comment Begin-->
					<div id="commdiv" class="comment">
						<!---->
						<form id="commform" name="commform"   method="post">
						<input name="newsid" value="$!thisNews.id" type="hidden" />
						<input name="typeid" value="$!thisType.id" type="hidden" />
						<div class="rec">
							<h3>评论</h3>
							<a class="geti" href="javascript:void(0)" onclick="_getIco(this)">表情</a>
							<span class="tip">评论( <strong>$comments.size()</strong> )</span>
							<textarea cols="80" rows="8" name="comment" type="text" id="comment" /></textarea>
							<input class="btn" type="button" value="发送" name="saveComment" onclick="doComment()" />
						</div>
						</form>
						
						
						<form id="commListform" name="commListform" action="/user.do?parameter=deleteComment" method="post">	
						<div class="ret" id="comment_list"></div>
						</form>
						<div id="EmoList">
							<ul><li><a href="javascript:addEm(1)"><img src="/skin/WDYYhtml/images/emo1.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(2)"><img src="/skin/WDYYhtml/images/emo2.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(3)"><img src="/skin/WDYYhtml/images/emo3.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(4)"><img src="/skin/WDYYhtml/images/emo4.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(5)"><img src="/skin/WDYYhtml/images/emo5.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(6)"><img src="/skin/WDYYhtml/images/emo6.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(7)"><img src="/skin/WDYYhtml/images/emo7.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(8)"><img src="/skin/WDYYhtml/images/emo8.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(9)"><img src="/skin/WDYYhtml/images/emo9.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(10)"><img src="/skin/WDYYhtml/images/emo10.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(11)"><img src="/skin/WDYYhtml/images/emo11.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(12)"><img src="/skin/WDYYhtml/images/emo12.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(13)"><img src="/skin/WDYYhtml/images/emo13.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(14)"><img src="/skin/WDYYhtml/images/emo14.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(15)"><img src="/skin/WDYYhtml/images/emo15.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(16)"><img src="/skin/WDYYhtml/images/emo16.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(17)"><img src="/skin/WDYYhtml/images/emo17.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(18)"><img src="/skin/WDYYhtml/images/emo18.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(19)"><img src="/skin/WDYYhtml/images/emo19.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(20)"><img src="/skin/WDYYhtml/images/emo20.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(21)"><img src="/skin/WDYYhtml/images/emo21.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(22)"><img src="/skin/WDYYhtml/images/emo22.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(23)"><img src="/skin/WDYYhtml/images/emo23.gif" alt="" /></a></li>
								<li><a href="javascript:addEm(24)"><img src="/skin/WDYYhtml/images/emo24.gif" alt="" /></a></li>
								<li></li>
								<li></li>
								<li></li>
								<li></li>
							</ul>
						</div>
						<div id="logTip">
							仅 [ WANDA A&amp;E ] 会员可以评论<br />请先 <a href="/user.do?parameter=login">登录</a> | <a href="/user.do?parameter=reg">注册</a>
						</div>
					</div>
					<!--Comment End-->